package com.zhuimeng.elasticsearchdemo.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.data.elasticsearch.client.ClientConfiguration;
import org.springframework.data.elasticsearch.client.RestClients;
import org.springframework.data.elasticsearch.config.AbstractElasticsearchConfiguration;

@Configuration
public class RestClientConfig{
    @Bean
    public RestHighLevelClient elasticsearchClient() {
        HttpHost[] httpHosts = new HttpHost[1];
        httpHosts[0] = new HttpHost("192.168.56.121",9200,"http");
        return new RestHighLevelClient(RestClient.builder(httpHosts));
    }
}
